/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GaoBo
 * Date: 2021-04-11
 * Time: 8:26
 */
public class TestDemo {

    /**
     * 求菲薄那切数列的第n项
     * @param n
     * @return
     */
    public static int fib(int n) {
        int f1 = 1;
        int f2 = 1;
        int f3 = 1;
        for (int i = 3; i <= n; i++) {
            f3 = f1+f2;
            f1 = f2;
            f2 = f3;
        }
        return f3;
    }

    public static int max2(int a,int b) {
        return a > b ? a:b;
    }

    public static int max3(int a,int b,int c) {
        int max = max2(a,b);
        return max > c ? max : c;
    }
    public static void main(String[] args) {
        System.out.println(max3(2, 5, 1));


        /*int ret = fib(2);
        System.out.println(ret);
        System.out.println(fib(4));*/
    }

    public static void main1(String[] args) {
        int[] array = {1,3,2,2,1};//1+3+2     2+1+3
        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= array[i];
        }
        System.out.println(ret);
    }
}
